package pers.litao.bit.order.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import pers.litao.bit.commons.utils.R;
import pers.litao.bit.commons.utils.SysUtil;
import pers.litao.bit.order.service.DistributionService;

import javax.servlet.http.HttpServletRequest;

/**
 * @author 李涛
 * @date 2020-12-08 15:04
 */
@RestController
@RequestMapping("/order/distribution")
public class DistributionController {

    @Autowired
    private DistributionService distributionService;

    /**
     * 查看合并的配送订单
     *
     * @param current
     * @param request
     * @return
     */
    @RequestMapping("/list/{current}")
    public R getList(@PathVariable("current") Long current,HttpServletRequest request){
        return distributionService.getList(current, SysUtil.getLoginUserInfo(request));
    }

    /**
     * 单个订单点击配送完成
     *
     * @param id
     * @param request
     * @return
     */
    @RequestMapping("/overorder/{id}")
    public R overOrder(@PathVariable("id") Long id,HttpServletRequest request){
        return distributionService.overOrder(id,SysUtil.getLoginUserInfo(request));
    }
}
